import java.util.*;
public class demo03 {
    private static int ans;
    private static int[][] g = new int[7][7];
    private static boolean[] vis = new boolean[7];
    private static boolean[] flag = new boolean[7];

    private static void bfs(int x) {
        LinkedList<Integer> que = new LinkedList<Integer>();
        que.offer(x);
        vis[x] = true;
        while (!que.isEmpty()) {
            int u = que.peek();
            que.poll();
            for (int i = 0; i <= 6; i++) {
                if (g[u][i] != 0 && flag[i] && !vis[i]) {
                    vis[i] = true;
                    que.offer(i);
                }
            }
        }
    }
    private static boolean check(int x) {
        for (int i = 0; i <= 6; i++) {
            flag[i] = vis[i] = false;
        }
        int cnt = 0;
        for (int i = 6; i >= 0; i--) {
            if ((x >> i & 1) != 0) {
                flag[i] = true;
            }
        }
        for (int i = 0; i <= 6; i++) {
            if (flag[i] && !vis[i]) {
                bfs(i);
                cnt++;
            }
        }
        return cnt == 1;
    }
    public static void main(String[] args) {
        g[0][1] = g[0][5] = 1;
        g[1][0] = g[1][2] = g[1][6] = 1;
        g[2][1] = g[2][3] = g[2][6] = 1;
        g[3][2] = g[3][4] = 1;
        g[4][3] = g[4][5] = g[4][6] = 1;
        g[5][0] = g[5][4] = g[5][6] = 1;
        g[6][1] = g[6][2] = g[6][4] = g[6][5] = 1;
        for (int i = 0; i < (1 << 7); i++) {
            if (check(i)) {
                ans++;
            }
        }
        System.out.print(ans);
        System.out.print('\n');
    }
}